package kr.memberAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import kr.controller.Action;
import kr.dao.CouponDao;
import kr.domain.Member;

public class UpdateProAction implements Action{

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		HttpSession session = request.getSession();
		if(session.getAttribute("memId")==null)
				return "/view/loginForm.jsp";
		request.setCharacterEncoding("euc-kr");
		
		Member member = new Member();
		/******************************/
		member.setId((String)session.getAttribute("memId"));
		member.setName(request.getParameter("name"));
		member.setPasswd(request.getParameter("passwd"));
		member.setEmail(request.getParameter("email"));
		member.setPhone(request.getParameter("phone"));
		CouponDao dao = CouponDao.getInstance();
		
		dao.updateMember(member);
		
		return "/view/updatePro.jsp";		
	}
}
